package edu.ucsc.gameAI.hfsm;

import pacman.game.Game;
import edu.ucsc.gameAI.IAction;
import edu.ucsc.gameAI.ICondition;
import edu.ucsc.gameAI.conditions.PacmanLastMove;

public class HTransition implements IHTransition {

	protected IHState targetState;
	protected IAction action;
	protected ICondition condition;
	protected int level;

	public HTransition(IHState targetState, ICondition condition) {
		this.targetState = targetState;
		this.condition = condition;
	}

	public HTransition(IHState targetState, ICondition condition, int level,
			IAction action) {
		this.targetState = targetState;
		this.condition = condition;
		this.level = level;
		this.action = action;
	}

	@Override
	public IHState getTargetState() {
		return targetState;
	}

	@Override
	public void setTargetState(IHState targetState) {
		this.targetState = targetState;
	}

	@Override
	public IAction getAction() {
		return action;
	}

	@Override
	public void setAction(IAction action) {
		this.action = action;
	}

	@Override
	public void setCondition(ICondition condition) {
		this.condition = condition;
	}

	@Override
	public boolean isTriggered(Game game) {
		return condition.test(game);
	}

	@Override
	public int getLevel() {
		return level;
	}

	@Override
	public void setLevel(int level) {
		this.level = level;
	}

}
